#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e7+100;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL dp[maxn];
LL f[100];
map<LL,LL>map1;
int main(void)
{
  /*
  dp[0]=0;dp[1]=1;
  map1[dp[0]]++;

  map1[dp[1]]++;
  for(LL i=2;i<=1000;i++){
    dp[i]=dp[i/2]+dp[i/4];
    map1[dp[i]]++;
  }
  for(auto i:map1){
    cout<<i.first<<" "<<i.second<<"\n";
  }*/

  f[0]=0;f[1]=1;f[2]=2;
  for(LL i=3;i<=100;i++) f[i]=f[i-1]+f[i-2];
  LL t;scanf("%lld",&t);
  while(t--){
    LL n;scanf("%lld",&n);
    if(n==0) printf("0\n");
    else if(n==1||n==2||n==3) printf("1\n");
    else{
        LL sum=0;
        while(n>0){
            n/=2;sum++;
        }
        printf("%lld\n",f[sum-1]);
        /*
        for(LL i=1;i<=60 ;i++){
            __int128 x=(1<<i)-1;

            if(x>=n){
                printf("%lld\n",f[i]);
                break;
            }

        }
    }
    */
  }
}
return 0;
}
